<template>
  <view class="listContainer">
    <!-- 列表上方的名称和跳转更多 -->
    <slot></slot>
    <block v-for="(item, index) in newsList" :key="index">
      <view class="listCell" @click="onRouteDetail(item)">
        <u-image
          width="140rpx"
          height="140rpx"
          border-radius="10rpx"
          :src="item.img_url"
        />
        <view class="contentRight">
          <view class="listTitle">
            {{ item.name }}
          </view>
          <view class="contentBottom">
            <view style="color: #ccc;font-size: 24rpx;">{{item.create_time}}</view>
            <view>
              <u-tag text="审核不通过" v-if="item.audit_status === 0" size="mini" type="error" />
              <u-tag text="审核通过" v-if="item.audit_status === 1" size="mini" type="success" />
              <u-tag text="待处理" v-if="item.audit_status === 2" size="mini" type="warning" />
              <!-- <u-tag text="待审核" v-if="item.status === 3" size="mini" color="#2979ff" bg-color="#a0cfff" border-color="#2979ff"/> -->
              <u-tag text="待审核" v-if="item.audit_status === 3" size="mini" type="info"/>
              <u-tag text="驳回" v-if="item.audit_status === 4" size="mini" type="error"/>
            </view>
          </view>
        </view>
      </view>
    </block>
  </view>
</template>
<script>
import moment from "moment";
export default {
  name: "News",
  props: {
    toPage: {
      type: String,
      default: "newsDetail",
    },
    newsList: {
      type: Array,
      default: []
    },
    feedBadgeNum: {
      type: Number
    },
    auditBadgeNum: {
      type: Number
    },
    finishedBadgeNum: {
      type: Number
    },
    titleName: {
      type: String
    }
  },
  data() {
    return {


    };
  },
  methods: {
    moment,
    // 点击跳转详情
    onRouteDetail(item) {
      // console.log('onRouteDetail---', item, this.toPage, this.titleName);
      if (this.toPage === 'judgeSui') {
        if (item.audit_status === 2) {
          // console.log('judgeSui--if', item, 2)
          this.$Router.push({
            name: 'suiSubmit',
            data: {
              content_id: item.content_id,
              titleName: this.titleName
            },
          });
        } else {
          // console.log('judgeSui--else');
          this.$Router.push({
            name: 'myPaiAndFb',
            data: {
              content_id: item.content_id,
              titleName: this.titleName
            },
          });
        }
        return
      }
      if (this.toPage === 'judgeFeedBack') {
          this.$Router.push({
            name: 'myPaiAndFb',
            data: {
              content_id: item.content_id,
              titleName: this.titleName
            }
          })
        return
      }
      this.$Router.push({
        name: this.toPage,
        data: {
          content_id: item.content_id,
          feedBadgeNum: this.feedBadgeNum,
          auditBadgeNum: this.auditBadgeNum,
          finishedBadgeNum: this.finishedBadgeNum
        },
      });
    }
  },
};
</script>
<style lang="scss" scoped>
.listContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-bottom: 30rpx;
  width: 100%;
  border-radius: 20rpx;
  background-color: #ffffff;
  /*box-shadow: 0 5rpx 20rpx 0 rgba(0, 0, 0, 0.05);*/
}


.hotActivityTourTitle {
  border: none;
}


.listCell {
  display: flex;
  position: relative;
  width: 100%;
  height: 160rpx;
  padding: 10rpx;
  /* border-bottom: 1rpx solid #e9f2fe; */
}
.listCell:after {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 570rpx;
  height: 1rpx;
  content: "";
  border-bottom: 1rpx solid #e9f2fe;
}
.contentRight {
  padding: 0 32rpx;
  width: 100%;
  height: 160rpx;
}
.contentBottom {
  display: flex;
  justify-content: space-between;
}
.listTitle {
  margin: 12rpx 0 20rpx;
  height: 62rpx;
  font-size: 31rpx;
  font-weight: 700;
}
/deep/ .u-tag {
  width: 130rpx;
  text-align: center;
}
</style>
